<script setup>
import QuotationView from '../components/QuotationView.vue';
const props = defineProps({
  modelValue: {
    type: Boolean,
    default: false,
  },
  fileInfo: {
    type: Object,
    default: () => {},
  },
  isConfirm: {
    type: Boolean,
    default: false,
  },
});

const emits = defineEmits(['update:modelValue', 'close', 'confirm']);

// 关闭弹窗
const onClose = () => {
  emits('update:modelValue', false);
};

/**
 * 确认选择
 */
const handleSubmit = () => {
  emits('close');
  emits('confirm');
};
</script>

<template>
  <el-dialog
    width="1000px"
    v-model="props.modelValue"
    :title=" $t('mall.confirm_bom')"
    center
    :before-close="onClose"
  >
    <!-- 贴片列表 -->
    <QuotationView :fileId="fileInfo.fileId" :showOperation="!props.isConfirm" />
    <template #footer>
      <span class="dialog-footer">
        <el-button palin @click="onClose">{{ $t('smt.Cancel') }}</el-button>
        <el-button v-if="!props.isConfirm" type="primary" @click="handleSubmit()">
          {{ $t('mall.confirm') }}
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<style scoped>
.icon {
  cursor: pointer;
}
</style>
